package com.example.mq.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.example.mq.dto.Msg;
import com.example.mq.po.MsgConsumePO;

import java.time.LocalDateTime;

/*
@description:
@ClassName MsgConsumerService
@author chen
@create 2025-08-22 15:50
@Version 1.0
*/
public interface MsgConsumerService extends IService<MsgConsumePO>
{
    /*
     * @==============History===============<br/>;
     * @Description //   获取消息的消费记录,记录不存在测创建一条消息
     * @Date 2025/8/22
     * @Author < a href="chencheng@prmt.net">chen</ a>;
     */
    MsgConsumePO getAndCreate(Msg<?> msg, String name, String queueName);


    /*
     * @==============History===============<br/>;
     * @Description // 插入一条消费记录
     * @Date 2025/8/22
     * @Author < a href="chencheng@prmt.net">chen</ a>;
     */
    MsgConsumePO insert(Msg<?> msg, String consumer, String queueName);

    /*
     * @==============History===============<br/>;
     * @Description //   将消息消费记录状态置为成功
     * @Date 2025/8/22
     * @Author < a href="chencheng@prmt.net">chen</ a>;
     */
    void updateStatusSuccess(String id, Integer status);

    /*
     * @param nextRetryTime
     * @==============History===============<br/>;
     * @Description //   将消息消费记录状态置为失败
     * @Date 2025/8/22
     * @Author < a href="chencheng@prmt.net">chen</ a>;
     */
    void updateStatusFail(String id, Integer status, String failMsg, boolean retry, LocalDateTime nextRetryTime);

}
